#

| Chapter 32 GNU Emacs |

## 32.2 Emacs Features: A Laundry List

Here's the list we promised - my personal list of favorite features:

Windows

  Emacs is a "windowed editor." Before anyone heard of the X Window System or the Macintosh, Emacs had the ability to divide a terminal's screen into several "windows," allowing you to do different things in each window. You can edit a different file in each window or read mail in one window, answer mail in another, issue shell commands in a third, and so on. Now that we all have nice workstations with mice and other crawly things for navigating around a bitmapped screen, why do you care? First, you may not have a bitmapped screen, and even if you have one in the office, you may not at home. Second, I still find Emacs preferable to most "modern" window systems because I don't have to use a mouse. If I want to create another window, I just type `CTRL-x` `2` (which splits the current window, whatever it is, into two); if I want to work in another window, I just type `CTRL-x` `o`; if I want to delete a window, I type `CTRL-x` `0`. Is this faster than reaching for my mouse and moving it around? You bet. Particularly since my mouse is hidden under a pile of paper. (Of course, it's hidden because I hardly ever need it.) Once you've created a window, it's just as easy to start editing a new file, initiate a shell session, and so on.

Shells

  You can start an interactive shell within any Emacs window; just type `ESC x shell`, and you'll see your familiar shell prompt. It's easy to see why this is so useful. It's trivial to return to earlier comands, copy them, and edit them. Even more important, you can easily take the output of a command and copy it into a text file that you're editing - obviously an extremely useful feature when you're writing a book like this. Emacs also lets you issue commands that operate on the contents of a window or a selected region within a window.

Keyboard Macros

  Emacs lets you define "keyboard macros," sequences of commands that can be executed automatically. This is similar to vi's map (31.2) facility, with one extra twist: Emacs actually executes the commands while you're defining the macro, while vi expects you to figure out what you need to do, type it in without any feedback, and hope that the macro doesn't do anything hostile when you edit it. With Emacs, it's much easier to get the macro right. You can see what it's going to do as you're defining it, and if you make a mistake, you can correct it immediately.

Editing Modes

  Emacs has a large number of special editing "modes" that provide "context sensitive" help while you're writing. For example, if you're writing a C program, the C mode will help you to observe conventions for indentation and commenting. It automatically lines up braces for you, and tells you when parentheses are unbalanced. There are special modes for virtually every programming language I've ever heard of. There are also special modes for HTML, troff, TeX, outlines, stick figures, etc.

Mail

  Although I often use Emacs' mail facility as an example, I'm not personally fond of it. However, if you really like working within the Emacs environment, you should try it.

Customization

  Emacs is the most customizable tool I've ever seen. Customization is based on the LISP programming language, so you need to learn some LISP before you can work with it much. However, once you know LISP, you can do virtually anything. For example, I have no doubt that you could write a complete spreadsheet program within Emacs - which means that you could use your normal Emacs commands to edit the spreadsheet and incorporate it (in whole or in part) into your documents. (An Emacs-based spreadsheet may already exist, though I'm not aware of it.) And, because of the FSF's (52.9) General Public License, virtually all special-purpose packages are available for free.

- ML

32.1 Emacs: The Other Editor |  | 32.3 Customizations and How to Avoid Them